<?php
namespace Admin\Model;
use Think\Model\RelationModel;
class CateModel extends RelationModel {
    protected $_link = array(
        'goods_type'  =>  array(
            'mapping_type'          => self::BELONGS_TO,//必填项 确定表之间的关系
            'class_name'            => 'goods_type',//必填项 要关联的表名(副表)
            'foreign_key'           => 'goods_type_id',//必填项 指中间表中主表的外键字段
            'as_fields'             => 'name:tname',//可选项 被关联表要过滤的字段

        ),
    );
}